<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\lbs\api\service\printtemplate;

class TemplateBaseData {
	
	static $_TSPEC;
	public $templateId = null;
	public $carrierCode = null;
	public $templateName = null;
	public $templateUrl = null;
	public $platformTemplateURL = null;
	public $platformTemplateName = null;
	public $templateWidth = null;
	public $templateHeight = null;
	public $defaultTemplate = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'templateId'
			),
			2 => array(
			'var' => 'carrierCode'
			),
			3 => array(
			'var' => 'templateName'
			),
			4 => array(
			'var' => 'templateUrl'
			),
			5 => array(
			'var' => 'platformTemplateURL'
			),
			6 => array(
			'var' => 'platformTemplateName'
			),
			7 => array(
			'var' => 'templateWidth'
			),
			8 => array(
			'var' => 'templateHeight'
			),
			9 => array(
			'var' => 'defaultTemplate'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['templateId'])){
				
				$this->templateId = $vals['templateId'];
			}
			
			
			if (isset($vals['carrierCode'])){
				
				$this->carrierCode = $vals['carrierCode'];
			}
			
			
			if (isset($vals['templateName'])){
				
				$this->templateName = $vals['templateName'];
			}
			
			
			if (isset($vals['templateUrl'])){
				
				$this->templateUrl = $vals['templateUrl'];
			}
			
			
			if (isset($vals['platformTemplateURL'])){
				
				$this->platformTemplateURL = $vals['platformTemplateURL'];
			}
			
			
			if (isset($vals['platformTemplateName'])){
				
				$this->platformTemplateName = $vals['platformTemplateName'];
			}
			
			
			if (isset($vals['templateWidth'])){
				
				$this->templateWidth = $vals['templateWidth'];
			}
			
			
			if (isset($vals['templateHeight'])){
				
				$this->templateHeight = $vals['templateHeight'];
			}
			
			
			if (isset($vals['defaultTemplate'])){
				
				$this->defaultTemplate = $vals['defaultTemplate'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'TemplateBaseData';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("templateId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->templateId);
				
			}
			
			
			
			
			if ("carrierCode" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->carrierCode);
				
			}
			
			
			
			
			if ("templateName" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->templateName);
				
			}
			
			
			
			
			if ("templateUrl" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->templateUrl);
				
			}
			
			
			
			
			if ("platformTemplateURL" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->platformTemplateURL);
				
			}
			
			
			
			
			if ("platformTemplateName" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->platformTemplateName);
				
			}
			
			
			
			
			if ("templateWidth" == $schemeField){
				
				$needSkip = false;
				$input->readDouble($this->templateWidth);
				
			}
			
			
			
			
			if ("templateHeight" == $schemeField){
				
				$needSkip = false;
				$input->readDouble($this->templateHeight);
				
			}
			
			
			
			
			if ("defaultTemplate" == $schemeField){
				
				$needSkip = false;
				$input->readByte($this->defaultTemplate); 
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('templateId');
		$xfer += $output->writeString($this->templateId);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('carrierCode');
		$xfer += $output->writeString($this->carrierCode);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->templateName !== null) {
			
			$xfer += $output->writeFieldBegin('templateName');
			$xfer += $output->writeString($this->templateName);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->templateUrl !== null) {
			
			$xfer += $output->writeFieldBegin('templateUrl');
			$xfer += $output->writeString($this->templateUrl);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->platformTemplateURL !== null) {
			
			$xfer += $output->writeFieldBegin('platformTemplateURL');
			$xfer += $output->writeString($this->platformTemplateURL);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->platformTemplateName !== null) {
			
			$xfer += $output->writeFieldBegin('platformTemplateName');
			$xfer += $output->writeString($this->platformTemplateName);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->templateWidth !== null) {
			
			$xfer += $output->writeFieldBegin('templateWidth');
			$xfer += $output->writeDouble($this->templateWidth);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->templateHeight !== null) {
			
			$xfer += $output->writeFieldBegin('templateHeight');
			$xfer += $output->writeDouble($this->templateHeight);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->defaultTemplate !== null) {
			
			$xfer += $output->writeFieldBegin('defaultTemplate');
			$xfer += $output->writeByte($this->defaultTemplate);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>